package common.util.redis.service;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.Tuple;
import redis.clients.util.Pool;

import java.util.List;
import java.util.Map;
import java.util.Set;

public interface JedisService {

    Long del(String key) throws Exception;

    Pool<Jedis> getJedisPool() throws Exception;

    void setJedisPool(Pool<Jedis> jedisPool) throws Exception;

    String getStr(String key) throws Exception;

    Long hdel(final String key, final String field) throws Exception;

    Long hset(final String key, final String field, final Object value, int seconds) throws Exception;

    Long hlen(final String key) throws Exception;

    boolean isExist(String key) throws Exception;

    Object lindex(String key, int index) throws Exception;

    void lpush(String key, Object value) throws Exception;

    List<Object> lrange(String key, int start, int end) throws Exception;

    void lset(String key, int index, Object value) throws Exception;

    Long rpushStr(String key, String value) throws Exception;

    void set(String key, Object value) throws Exception;

    void set(String key, Object value, int seconds) throws Exception;

    void setStr(String key, String value) throws Exception;

    String setexStr(String key, String value, int seconds) throws Exception;

    Long setNxStr(String key, String value) throws Exception;

    Long setNxStr(String key, String value, int seconds) throws Exception;

    Long zadd(String key, double score, Object member) throws Exception;

    Long zadd2(String key, double score, long member) throws Exception;

    Long zaddStr(String key, double score, String member) throws Exception;

    Long zcard(String key) throws Exception;

    Long zcount(String key, double min, double max) throws Exception;

    Long zrank(String key, Object member) throws Exception;

    Long zrem(String key, Object member) throws Exception;

    Long zrem2(String key, String member) throws Exception;

    Long zremLong(String key, long member) throws Exception;

    Long zremrangeByRank(String key, long start, long end) throws Exception;

    Long zremrangebyscore(String key, String start, String end) throws Exception;

    List<Object> zrevrange(String key, int start, int end) throws Exception;

    List<Long> zrevrange2(String key, int start, int end) throws Exception;

    List<Long> zrevrange3(String key, int start, int end) throws Exception;

    List<String> zrevrange4(String key, int start, int end) throws Exception;

    Set<Tuple> zrevrangeWithScores(String key, int start, int end) throws Exception;

    Set<Tuple> zrangeWithScores(String key, int start, int end) throws Exception;

    Long zrevrank(String key, Object member) throws Exception;

    Long zrevrank2(String key, String member) throws Exception;

    Long zrevrank3(String key, long member) throws Exception;

    long incr(String key) throws Exception;

    long incrBy(String key, long integer) throws Exception;

    long incrBy2(String key, long integer) throws Exception;

    double incrByFloat(String key, double member) throws Exception;

    long expire(String key, int seconds) throws Exception;

    String spop(String key) throws Exception;

    long decr(String key) throws Exception;

    long decrBy(String key, long integer) throws Exception;

    Long sadd(String key, String... member) throws Exception;

    Set<String> keys(String key) throws Exception;

    Long rpush(String key, String... strings) throws Exception;

    String lpopStr(String key) throws Exception;

    Long hset(String key, String field, String value) throws Exception;

    Boolean hexists(String key, String field) throws Exception;

    long hincrby(String key, String field, long integer) throws Exception;

    Long hdel(String key, String... fields) throws Exception;

    Long llen(String key) throws Exception;

    List<Object> zrange(String key, long start, long end) throws Exception;

    List<String> zrange1(String key, long start, long end) throws Exception;

    Long lrem(String key, long count, String value) throws Exception;

    Double zscore(String key, Object member) throws Exception;

    Double zscore2(String key, String member) throws Exception;

    Double zincrby(String key, double score, Object member) throws Exception;

    Double zincrbyStr(String key, double score, String member) throws Exception;

    Double zincrby2(String key, long score, String member) throws Exception;

    Map<String, String> hgetAllStr(String key) throws Exception;

    Long hsetStr(String key, String field, String value, int seconds) throws Exception;

    String hgetStr(String key, String field) throws Exception;

    public Long hsetStr(String key, String field, String value) throws Exception;

    List<String> hvals(String key) throws Exception;

    Set<String> smembers(String key) throws Exception;

    List<Object> zrangeBySore(String key, double startScore, double endScore) throws Exception;

    List<String> zrangeByScore1(String key, double startScore, double endScore) throws Exception;

    void ltrim(String key, int start, int end) throws Exception;

    Long scard(String key) throws Exception;

    Long srem(String key, String member) throws Exception;

    /**
     * Set（集合） 随机一个
     *
     * @param key
     * @param count
     * @return
     * @throws Exception
     */
    List<String> srandMember(String key, int count) throws Exception;

    List<String> zrangeByScoreLimit(String key, double startScore, double endScore, int offset, int count) throws Exception;
}
